package com.yhy.manager.job;

import com.yhy.manager.service.LogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

@Component
public class AnalysisJob {

    @Autowired
    private LogService logService;


    @Scheduled(cron = "0/10 * * * * ?")
    public void analysisLog() throws ParseException {
        String todayStr = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
        System.out.println("开始统计时间:"+todayStr);
        logService.analysis();
        System.out.println("结束统计");
    }
}
